home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 2385 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  984 b 

  1. Path: ix.netcom.com!netnews
  2. From: miker3@ix.netcom.com (Mike Rubenstein)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: cpp question
  5. Date: Sat, 20 Jan 1996 22:14:36 GMT
  6. Organization: Netcom
  7. Message-ID: <31016894.165498560@nntp.ix.netcom.com>
  8. References: <4drm99$j0m@peabody.colorado.edu>
  9. NNTP-Posting-Host: ix-dc12-18.ix.netcom.com
  10. X-NETCOM-Date: Sat Jan 20  2:14:35 PM PST 1996
  11. X-Newsreader: Forte Agent .99c/16.141
  12.  
  13. woodjr@rintintin.Colorado.EDU (WOOD  JAMEY RYAN) wrote:
  14.  
  15. > I have something like this:
  16. >      #define USERLEN 8
  17. >      #define HOSTLEN 15
  18. >      char name[] = "woodjr";
  19. >      char host[] = "really.long.hostname.com";
  20. >      char s[100];
  21. >      sprintf(s, "%.USERLENs@%.HOSTLENs", name, host);
  22. > And I want cpp to parse the sprintf line to:
  23. >      sprintf(s, "%.8s@%.15s", name, host);
  24. > Which it (of course) isn't doing.  Is there some syntax I
  25. > can use to get it to do this?
  26.  
  27.     sprintf(s, "%.*s@%.*s", USERLEN, name, HOSTLEN, host);
  28.  
  29.  
  30. Michael M Rubenstein
  31.